<?php
/**
 * Pipahr
 *
 * @author Wei Ma
 * @copyright 2014 pipahr.com
 */
$l=OC_L10N::get('reports');
$user = PFactory::getUser();
require_once(OC::$SERVERROOT . "/apps/reports/lib/helper.php");
require_once(OC::$SERVERROOT . "/apps/resumes/lib/helper.php");
JLoader::register('ProvinceHelper', JPATH_SITE.'/components/com_city/helper.php');

if(isset($user->cb_usertype) && $user->cb_usertype == 'jobseeker'){
   return;
}

if (PFactory::isMasterUser()) {
   $href = OCP\Util::linkToRoute("reports_home");
   $data = PReportsHelper::getLastJobgroup();
   if (!empty($data['fid'])) {
      $href = PResumesHelper::getSearchItemHref($href, 'fid', $data['fid'])[0];
   }
   OCP\App::addNavigationEntry( array( "id" => "reports_index",
   "order" => 4,
   "href" => $href,
   "class" => "hr_i_reports",
   "name" => "统计报表" ));
}

/* link to joomla framework */

require_once(OC::$SERVERROOT.'/apps/joomla/application.php');

JLoader::import('joomla.application.component.model', JPATH_LIBRARIES);

// init pipapai application
PFactory::init();

